﻿@{
    ViewBag.Title = "Template";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<ul class="breadcrumb" style="margin-bottom: 7px;">
    <li><a href="#">首页</a> <span class="divider">/</span></li>
    <li><a href="#">系统管理</a> <span class="divider">/</span></li>
    <li class="active">模板下载</li>
</ul>
<div class="panel-body" id="grid">
</div>
<script type="text/javascript">
    var Overlay = BUI.Overlay
    var dialog = null;
    var Grid = BUI.Grid,
    Store = BUI.Data.Store,
    columns = [
      { title: '模板文件路径~/Templates/', sortable: false, dataIndex: 'TempFileName' },
      {
          title: '操作', sortable: false, dataIndex: 'TempFileName',
          renderer: function (value, obj) {
              return '<span class="grid-command" onclick="Edit(\'' + value + '\')" >编辑</span>';
          }
      }
    ];
    //加载列表
    var store = new Store({
        url: '/Admin/System/AjaxGetTemplate',
        proxy: {
            limitParam: 'pageSize',
            method: 'post'
        },
        autoLoad: true,
        pageSize: 10
    }),
    grid = new Grid.Grid({
        render: '#grid',
        loadMask: true,
        forceFit: true,
        plugins: [Grid.Plugins.AutoFit],
        columns: columns,
        store: store,
        bbar: {
            pagingBar: true
        }
    });
    grid.render();

    function Edit(tempUrl) {
        dialog = new Overlay.Dialog({
            title: '模板管理->编辑模板',
            width: 900,
            closeAction: 'destroy',
            height: 500,
            buttons: [],
            bodyStyle: { 'padding': '0px' },
            bodyContent: '<iframe frameborder="0" style="width:890px;height:438px" src="/Admin/System/EditTemp?tempUrl=' + tempUrl + '"></iframe>'
        });
        dialog.show();
    }
    function CloseWin() {
        alert('修改成功！');
        dialog.close();
    }

</script>
